package com.honghu.villagepost.activity.fragment;

import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.honghu.villagepost.R;
import com.honghu.villagepost.adapter.NoteAdapter;
import com.honghu.villagepost.base.BaseFragment;
import com.honghu.villagepost.entity.Note;
import com.youth.banner.adapter.BannerImageAdapter;
import com.youth.banner.indicator.CircleIndicator;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class MsgFragment extends BaseFragment {
    @BindView(R.id.breed_tv)
    TextView mBreedTv;
    @BindView(R.id.breed_category_tv)
    TextView mBreedCategoryTv;
    @BindView(R.id.date_tv)
    TextView mDateTv;
    @BindView(R.id.rv_list)
    RecyclerView mRvList;
    @BindView(R.id.banner)
    com.youth.banner.Banner banner;
    private NoteAdapter mNoteAdapter;

    @Override
    protected View initViews(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_msg, container, false);
        return view;
    }

    @Override
    protected void initData() {


        //自定义的图片适配器，也可以使用默认的BannerImageAdapter
        List<String> data = new ArrayList<>();
        BannerImageAdapter adapter = new BannerImageAdapter(data) {
            @Override
            public void onBindView(Object holder, Object data, int position, int size) {

            }
        };

        banner.setAdapter(adapter)
                .addBannerLifecycleObserver(this)//添加生命周期观察者
                .setIndicator(new CircleIndicator(getActivity()
                ))//设置指示器
        ;

        mRvList.setLayoutManager(new LinearLayoutManager(getActivity()));
        mNoteAdapter = new NoteAdapter();
        mRvList.setAdapter(mNoteAdapter);

        mNoteAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {

            }
        });

        mNoteAdapter.addData(new Note());
        mNoteAdapter.addData(new Note());
        mNoteAdapter.addData(new Note());
        mNoteAdapter.addData(new Note());
        mNoteAdapter.addData(new Note());

    }

    @OnClick({R.id.breed_tv, R.id.breed_category_tv, R.id.date_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.breed_tv:
                break;
            case R.id.breed_category_tv:
                break;
            case R.id.date_tv:
                break;
        }
    }
}
